<?php


namespace app\crm\validate;


use think\Validate;

/**
 * Class Article
 * @package app\admin\validate
 */
class Setting extends Validate
{

    /**
     * 验证规则
     * @var string[]
     */
    protected $rule = [
        'id'          => 'require|number|gt:0',
        'category_id' => 'require|gt:0',
        'name'        => 'require|unique:setting|max:50',
        'status'      => 'require|gt:0',
    ];

    /**
     * 错误信息
     * @var string[]
     */
    protected $message = [
        'id.require'          => '参数错误',
        'id.number'           => '参数错误',
        'id.gt'               => '参数错误',
        'category_id.require' => '请选择所属类型',
        'category_id.gt'      => '请选择所属类型',
        'name.require'        => '请填写名称',
        'name.unique'         => '名称已经存在',
        'name.max'            => '名称最多50个字符',
        'status.require'      => '请选择是否启用',
        'status.gt'           => '请选择是否启用',
    ];

    /**
     * 验证场景
     * @var string[]
     */
    protected $scene = [
        'create' => ['category_id', 'name', 'status'],
        'update' => ['category_id', 'name', 'status', 'id'],
    ];

}